﻿<?xml version="1.0" encoding="utf-8"?>
<Mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Entity type="MyNamespace:Library" table="Library" discriminator-field="Type" discriminator-value="MyNamespace:Library">
    <Id field="LibraryId">
      <Generator name="guid" />
    </Id>
    <Attribute name="name" table="Library" field="name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Reference name="MyBooks" entityChild="MyNamespace:Book">
      <Rule parentField="LibraryId" childTable="Book" childField="FK_LibraryId" not-null="false" />
    </Reference>
    <Reference name="Shelf" entityChild="MyNamespace:Shelf">
      <Rule parentField="FK_ShelfId" childTable="Shelf" childField="ShelfId" not-null="false" />
    </Reference>
  </Entity>
  <Entity type="MyNamespace:BabyLibrary" table="Library" discriminator-field="Type" discriminator-value="MyNamespace:BabyLibrary">
    <Id field="LibraryId">
      <Generator name="guid" />
    </Id>
  </Entity>
  <Entity type="MyNamespace:Book" table="Book">
    <Id field="BookId">
      <Generator name="guid" />
    </Id>
    <Attribute name="name" table="Book" field="name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
  </Entity>
  <Entity type="MyNamespace:Shelf" table="Shelf">
    <Id field="ShelfId">
      <Generator name="guid" />
    </Id>
    <Attribute name="name" table="Shelf" field="name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
  </Entity>
  <Entity type="MyNamespace:Person" table="Person">
    <Id field="PersonId">
      <Generator name="guid" />
    </Id>
    <Attribute name="FirstName" table="Person" field="FirstName" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="Age" table="Person" field="Age" db-type="Int32" size="0" scale="0" precision="0" not-null="false" />
    <Attribute name="Code" table="Person" field="Code" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="Title" table="Person" field="Title" db-type="AnsiString" size="50" scale="0" precision="0" not-null="false" />
    <Reference name="Friends" entityChild="MyNamespace:Person">
      <Rule parentField="PersonId" childTable="PersonFriend" childField="FK_PersonId" not-null="false" />
      <Rule parentField="FK_FriendId" childTable="Person" childField="PersonId" not-null="false" />
    </Reference>
    <Reference name="Deputy" entityChild="MyNamespace:Person">
      <Rule parentField="PersonId" childTable="Person" childField="FK_PersonId" not-null="false" />
    </Reference>
  </Entity>
  <Entity type="MyNamespace:Dog" table="Dog">
    <Id field="DogId">
      <Generator name="guid" />
    </Id>
    <Reference name="ChildDog" entityChild="MyNamespace:Dog">
      <Rule parentField="DogId" childTable="Dog" childField="FK_DogId" not-null="false" />
    </Reference>
  </Entity>
  <Entity type="MyNamespace:Company" table="Company" discriminator-field="Type" discriminator-value="MyNamespace:Company">
    <Id field="CompanyId">
      <Generator name="guid" />
    </Id>
    <Attribute name="logo" table="Company" field="logo" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="Code" table="Company" field="Code" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Reference name="Employees" entityChild="MyNamespace:Person">
      <Rule parentField="CompanyId" childTable="CompanyPerson" childField="FK_CompanyId" not-null="false" />
      <Rule parentField="FK_PersonId" childTable="Person" childField="PersonId" not-null="false" />
    </Reference>
  </Entity>
  <Entity type="MyNamespace:SARL" table="Company" discriminator-field="Type" discriminator-value="MyNamespace:SARL">
    <Id field="CompanyId">
      <Generator name="guid" />
    </Id>
  </Entity>
</Mapping>